﻿using System;
using System.Configuration;
using System.Web.Configuration;



namespace BBI.Infrastructure.Config
{
    public class ProductsElement : ConfigurationElement
    {
        [ConfigurationProperty("connectionStringName")]
        public string ConnectionStringName
        {
            get { return (string)this["connectionStringName"]; }
            set { this["connectionStringName"] = value; }
        }

        public string ConnectionString
        {
            get
            {
                string connStringName = null;
                if (string.IsNullOrEmpty(this.ConnectionStringName))
                {
                    connStringName = Globals.Settings.DefaultConnectionStringName;
                }
                else
                {
                    connStringName = this.ConnectionStringName;
                }
                return WebConfigurationManager.ConnectionStrings[connStringName].ConnectionString;
            }
        }

        [ConfigurationProperty("pageSize", DefaultValue = "10")]
        public int PageSize
        {
            get { return (int)this["pageSize"]; }
            set { this["pageSize"] = value; }
        }

        /// <summary>
        /// 组图目录
        /// </summary>
        [ConfigurationProperty("photosDirectory", DefaultValue = "Content/Uploads/Products/Photos/")]
        public string PhotosDirectory
        {
            get { return (string)this["photosDirectory"]; }
            set { this["photosDirectory"] = value; }
        }
        /// <summary>
        /// 组图缩略图目录
        /// </summary>
        [ConfigurationProperty("photosThumbDirectory", DefaultValue = "Content/Uploads/Products/Photos/ThumbNails/")]
        public string PhotosThumbDirectory
        {
            get { return (string)this["photosThumbDirectory"]; }
            set { this["photosThumbDirectory"] = value; }
        }

        [ConfigurationProperty("originalsDirectory", DefaultValue = "Originals")]
        public string OriginalsDirectory
        {
            get { return (string)this["originalsDirectory"]; }
            set { this["originalsDirectory"] = value; }
        }

        /// <summary>
        /// 产品分类LOGO目录
        /// </summary>
        [ConfigurationProperty("categoryLogoDirectory", DefaultValue = "Content/Uploads/Products/CategoryLogos/")]
        public string CategoryLogoDirectory
        {
            get { return (string)this["categoryLogoDirectory"]; }
            set { this["categoryLogoDirectory"] = value; }
        }



        /// <summary>
        /// 产品缩略图目录
        /// </summary>
        [ConfigurationProperty("productThumbDirectory", DefaultValue = "Content/Uploads/Products/Thumbnails/")]
        public string ProductThumbDirectory
        {
            get { return (string)this["productThumbDirectory"]; }
            set { this["productThumbDirectory"] = value; }
        }


        /// <summary>
        /// 产品缩略图宽度
        /// </summary>
        [ConfigurationProperty("thumbWidth", DefaultValue = "160")]
        public int ThumbWidth
        {
            get { return (int)this["thumbWidth"]; }
            set { this["thumbWidth"] = value; }
        }

        /// <summary>
        /// 产品缩略图高度
        /// </summary>
        [ConfigurationProperty("thumbHeight", DefaultValue = "120")]
        public int ThumbHeight
        {
            get { return (int)this["thumbHeight"]; }
            set { this["thumbHeight"] = value; }
        }


        /// <summary>
        /// 组图缩略图宽度
        /// </summary>
        [ConfigurationProperty("photoThumbW", DefaultValue = "80")]
        public int PhotoThumbW
        {
            get { return (int)this["photoThumbW"]; }
            set { this["photoThumbW"] = value; }
        }

        /// <summary>
        /// 组图缩略图高度
        /// </summary>
        [ConfigurationProperty("photoThumbH", DefaultValue = "80")]
        public int PhotoThumbH
        {
            get { return (int)this["photoThumbH"]; }
            set { this["photoThumbH"] = value; }
        }



        /// <summary>
        /// 
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        /// <remarks></remarks>
        [ConfigurationProperty("displayHeight", DefaultValue = "450")]
        public int DisplayHeight
        {
            get { return (int)this["displayHeight"]; }
            set { this["displayHeight"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        /// <remarks></remarks>
        [ConfigurationProperty("displayWidth", DefaultValue = "600")]
        public int DisplayWidth
        {
            get { return (int)this["displayWidth"]; }
            set { this["displayWidth"] = value; }
        }

    }

}